console.log('this is content.js file , run in the web page 888 ......')

// 将contentPage/index.html插入到当前页面中，并设置样式
const init = () => {
  const addIframe = (id, pagePath) => {
    const contentIframe = document.createElement('iframe')
    contentIframe.id = id
    contentIframe.style.cssText =
      'width: 30vw; height: 80vh; position: fixed;top:0px;right:0px; inset: 0px; z-index: 10000002; border: 1px solid red;'
    const getContentPage = chrome.runtime.getURL(pagePath)
    contentIframe.src = getContentPage
    document.body.appendChild(contentIframe)
  }

  addIframe('content-start-iframe', 'contentPage/index.html')
}

// 判断 window.top 和 self 是否相等，如果不相等，则不注入 iframe
if (window.top === window.self) {
  init()
}
